<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$plugin_name = $_RQ['basicname'] ? $_RQ['basicname'] : '';
if($_RQ['op']=='get'){
	//显示统计数据
		$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
		$mounthtime =  mktime(0,0,0,date('m'),1,date('Y'));
		$access=array();
		$access['item_day']=pdo_count('jy_xiaoeknow_video_jieitem',array('uniacid'=>$_SESSION['uniacid'],'jie_id'=>0,'merchid'=>$_SESSION['onemerchid'],'createtime >'=>$daytime));
		$access['vip_day']=pdo_count('jy_xiaoeknow_user',array('uniacid'=>$_SESSION['uniacid'],'isvip'=>1,'merchid'=>$_SESSION['onemerchid'],'updatetime >'=>$daytime));
		$access['viporder_day']=pdo_getsum('jy_xiaoeknow_viporder',array('uniacid'=>$_SESSION['uniacid'],'status'=>1,'merchid'=>$_SESSION['onemerchid'],'createtime >'=>$daytime),'fee');
		$access['video_order_day']=pdo_getsum('jy_xiaoeknow_video_order',array('uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'merchid'=>$_SESSION['onemerchid'],'createtime >'=>$daytime),'fee');
		$access['allfee_day']=$access['viporder_day']+$access['video_order_day'];
		$access['item_all']=pdo_count('jy_xiaoeknow_video_jieitem',array('uniacid'=>$_SESSION['uniacid'],'jie_id'=>0,'merchid'=>$_SESSION['onemerchid']));
		$access['vip_all']=pdo_count('jy_xiaoeknow_user',array('uniacid'=>$_SESSION['uniacid'],'isvip'=>1,'merchid'=>$_SESSION['onemerchid']));
		$access['viporder_all']=pdo_getsum('jy_xiaoeknow_viporder',array('uniacid'=>$_SESSION['uniacid'],'status'=>1,'merchid'=>$_SESSION['onemerchid']),'fee');
		$access['video_order_all']=pdo_getsum('jy_xiaoeknow_video_order',array('uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'merchid'=>$_SESSION['onemerchid']),'fee');
		$access['allfee_all']=$access['viporder_all']+$access['video_order_all'];
		//月份
		for($i=0;$i<12;$i++){
				if($i==0){
					$yuestart = mktime(0,0,0,date('m'),1,date('Y'));
					$yueend = time();
					
				}else{
					$yuestart = mktime(0,0,0,date('m')-$i,1,date('Y'));
					$yueend = mktime(0,0,0,date('m')-$i+1,1,date('Y'));
				}
				$params=array('uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'merchid'=>$_SESSION['onemerchid']);
				$params['createtime between']=array($yuestart,$yueend);
				$month12[$i] = date('Y-m',strtotime('-'.$i.' month'));
				$vip_data[]=pdo_getsum('jy_xiaoeknow_viporder',$params,'fee');
				$accessline[$i]=pdo_getsum('jy_xiaoeknow_video_order',$params,'fee');
		}
		$accessline=array_reverse($accessline);
		$month12=array_reverse($month12);
		$return['htmls']=array(
				array('type'=>'data','one_num'=>2,'title'=>'应用今日/总数据指标','datas'=>array(
					array('title'=>'课程内容数据','num'=>2,'data'=>array($access['item_day'],$access['item_all'])),
					array('title'=>'VIP人数','num'=>2,'data'=>array($access['vip_day'],$access['vip_all'])),
					array('title'=>'VIP金额','num'=>2,'data'=>array($access['viporder_day'],$access['viporder_all'])),
					array('title'=>'买课金额','num'=>2,'data'=>array($access['video_order_day'],$access['video_order_all'])),
					array('title'=>'总金额','num'=>2,'data'=>array($access['allfee_day'],$access['allfee_all'])),
				)),
				array('type'=>'echarts_arealine','ecid'=>'mobile','title'=>'月度买课数据','datas'=>array(
					'datas'=>array(
						array('name'=>'金额','value'=>$accessline),
					),
					'xdatas'=>$month12,
				)),
				array('type'=>'echarts_arealine','ecid'=>'vip','title'=>'月度VIP数据','datas'=>array(
					'datas'=>array(
						array('name'=>'金额','value'=>$vip_data),
					),
					'xdatas'=>$month12,
				)),
		);
	exi($return);
}